package com.jike.mahjong.task;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by star on 2016/12/30.
 */
public class TestTask {

    public static void main(String[] args) throws InterruptedException {

       /* Timer timer=new Timer();
        MsgTask task=new MsgTask("神啊！！！");
        timer.scheduleAtFixedRate(task,0,10*1000);

        Thread.sleep(5*1000);

        MsgTask.setDeclaredField(TimerTask.class,task,"period",1*1000);
        Date now = new Date();
        long nextExecutionTime = now.getTime() + 2*1000;*/
//        task.setNxtExecutionTime(1*1000,nextExecutionTime);


        ExecutorService   executorService= Executors.newFixedThreadPool(3);

        executorService.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("1000000000000"+Thread.currentThread().getName());
            }
        });

        executorService.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("2000000000000"+Thread.currentThread().getName());
            }
        }); executorService.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("3000000000000"+Thread.currentThread().getName());
            }
        });
        executorService.execute(new Runnable() {
            @Override
            public void run() {
                System.out.println("4000000000000"+Thread.currentThread().getName());
            }
        });

        executorService.shutdown();


    }
}
